package com.zuipin.quartz;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.QuartzJobBean;

import com.zuipin.framework.exception.CustomException;
import com.zuipin.service.IEvaluationInfoService;
import com.zuipin.service.IProductExtInfoService;
import com.zuipin.util.DateUtils;
import com.zuipin.util.RedisUtils;

import net.sf.json.JSONObject;

/**
 * 自动更新商品库存
 *
 * @ClassName UpdateStockJob 
 * @author wangcongyi
 * @date 2017年7月13日 下午4:44:24
 */
@Configuration
public class UpdateStockJob extends QuartzJobBean {

	@Resource
	private IProductExtInfoService productExtInfoService;
	private Logger log = Logger.getLogger(UpdateStockJob.class);

	@Override
	protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
		// TODO Auto-generated method stub
		log.info("自动更新商品库存--定时器---start----"+DateUtils.getCurrentDateTime());
		try {
			productExtInfoService.updateStock();
		} catch (CustomException e) {
			// TODO Auto-generated catch block
			log.info("自动更新商品库存"+e);
		}
		log.info("自动更新商品库存--定时器---end----"+DateUtils.getCurrentDateTime());
	}

}
